package com.jeomo.sys.starter.mapper;

import com.jeomo.base.starter.mapper.IBaseMapper;
import com.jeomo.sys.starter.entity.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色 Mapper 接口
 * </p>
 *
 * @author jeomo
 * @since 2019-03-22
 */
@Mapper
public interface RoleMapper extends IBaseMapper<Role> {

    @Select("select * from sys_role where top_org_code  = #{topOrgCode} and type = 2")
    List<Role> listGroup(String topOrgCode);

    /**
     * 需要传递两个参数 topOrgCode username
     * @param userCode
     * @return
     */
    List<Role> selectByUserCode(String userCode);

    /**
     * 根据用户名删除
     * @param userCode
     * @return
     */
    int deleteByUserCode(String userCode);

}
